﻿<%@ Page Language="C#" MasterPageFile="~/WebLicenseMain.Master" AutoEventWireup="true" CodeBehind="ManageCompanies.aspx.cs" Inherits="WebLicenseGenerator.ManageCompanies" Title="Sinacor Licenciamento - Cadastrar Empresas" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register Src="UC/WaitingProcess.ascx" TagName="WaitingProcess" TagPrefix="UC" %>
<%@ Register Src="UC/MaskedCNPJ.ascx" TagName="CNPJ" TagPrefix="UC" %>
<%@ Register Src="UC/Int32TextBox.ascx" TagName="Int32TextBox" TagPrefix="UC" %>
<%@ Register Src="UC/SimpleTextBox.ascx" TagName="SimpleTextBox" TagPrefix="UC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server" />
<asp:Content ID="Content2" ContentPlaceHolderID="pagePath" runat="server">Sinacor Licenciamento / Cadastrar Empresas</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="pageTitle" runat="server"><h1>CADASTRAR EMPRESAS</h1></asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="pageBody" runat="server">
	<asp:UpdatePanel ID="upPagePanel" runat="server">
		<ContentTemplate>
			<table width="100%">
				<tr>
					<td>Aliase&nbsp;Cadastrados:</td>
					<td colspan="2"><asp:DropDownList ID="cbAliases" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ComboBox_SelectedIndexChanged" /></td>
				</tr>
				<tr>
					<td colspan="3"><hr /></td>
				</tr>
				<tr>
					<td class="labels">Empresa</td>
					<td colspan="2"><UC:SimpleTextBox ID="txtCompanyName" runat="server" CssClass="textboxform" Width="350px" MaxLength="128" ErrorMessage="Informe um nome para a Empresa"/></td>
				</tr>
				<tr>
					<td class="labels">CNPJ</td>
					<td colspan="2"><UC:CNPJ ID="txtCNPJ" runat="server" Style="width: 120px" CssClass="textboxform" ValidateEmptyCNPJ="true" /></td>
				</tr>
				<tr valign="top">
					<td width="10% class="labels">ID</td>
					<td width="1"><UC:Int32TextBox ID="txtCompanySinacorID" runat="server" Style="width: 50px" CssClass="textboxform" ValidateEmptyText="true" MaxLength="8" />&nbsp;</td>
					<td width="90%"><asp:Button ID="btInsertNewCompany" runat="server" Text="Inserir nova Empresa" CssClass="button" OnClick="InsertNewCompany" /></td>
				</tr>
			</table>
			<table id="tbGridView" runat="server">
				<tr>
					<td>
						<fieldset class="tabela" style="width: 440px; height: 360px">
							<p>
								LISTA DE EMPRESAS CADASTRADAS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<div style="position: relative" enableviewstate="true">
									<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100">
										<ProgressTemplate>
											<UC:WaitingProcess ID="waitProcessProgressBar1" runat="server" Left="30%" />
										</ProgressTemplate>
									</asp:UpdateProgress>
									<div style="height: 300px; overflow: auto;" id="divScroll" enableviewstate="true" runat="server">
										<asp:GridView ID="grdSelectedCompanies" runat="server" Width="100%" AutoGenerateColumns="false">
											<Columns>
												<asp:TemplateField HeaderText="" HeaderStyle-BackColor="#666666" HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC" ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC">
													<ItemTemplate>
														<asp:CheckBox ID="chkIsSelected" runat="server" />
													</ItemTemplate>
													<HeaderStyle BackColor="#666666" BorderColor="#CCCCCC" BorderWidth="1px" ForeColor="White" />
													<ItemStyle BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" />
												</asp:TemplateField>
												<asp:BoundField DataField="CompanyId" HeaderText="Id Empresa" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="Name" HeaderText="Empresa" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="LegalRegistrationId" HeaderText="CNPJ" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="SinacorCompanyId" HeaderText="ID Sinacor" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:TemplateField HeaderText="(+)" HeaderStyle-BackColor="#666666" HeaderStyle-ForeColor="White"
													HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC" ItemStyle-BackColor="White"
													ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC">
													<ItemTemplate>
														<asp:Button ID="btUpdateCompanySelected" runat="server" CommandArgument='<%# Eval("CompanyId") %>' CommandName="UpdateSelected" Text="UPD" CausesValidation="false"/>
													</ItemTemplate>
													<HeaderStyle BackColor="#666666" BorderColor="#CCCCCC" BorderWidth="1px" ForeColor="White" />
													<ItemStyle BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" />
												</asp:TemplateField>
											</Columns>
										</asp:GridView>
									</div>
								</div>
							</p>
						</fieldset>
					</td>
					<td width="35" align="center">
						<table width="100%">
							<tr><td align="center"><asp:LinkButton ID="lnkMoveToLeft" runat="server" Text="<--" OnClick="MoveItemsToLeft" CausesValidation="false"/></td></tr>
							<tr><td align="center"><asp:LinkButton ID="lnkMoveToRight" runat="server" Text="-->" OnClick="MoveItemsToRight" CausesValidation="false"/></td></tr>
						</table>
					</td>
					<td>
						<fieldset class="tabela" style="width: 440px; height: 360px">
							<p>
								LISTA DE EMPRESAS DISPONIVEIS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<div style="position: relative" enableviewstate="true">
									<asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="100">
										<ProgressTemplate>
											<UC:WaitingProcess ID="waitProcessProgressBar2" runat="server" Left="30%" />
										</ProgressTemplate>
									</asp:UpdateProgress>
									<div style="height: 300px; overflow: auto;" id="div1" enableviewstate="true" runat="server">
										<asp:GridView ID="grdAvailableCompanies" runat="server" Width="100%" AutoGenerateColumns="false">
											<Columns>
												<asp:TemplateField HeaderText="" HeaderStyle-BackColor="#666666" HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC" ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC">
													<ItemTemplate>
														<asp:CheckBox ID="chkIsSelected" runat="server" />
													</ItemTemplate>
													<HeaderStyle BackColor="#666666" BorderColor="#CCCCCC" BorderWidth="1px" ForeColor="White" />
													<ItemStyle BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" />
												</asp:TemplateField>
												<asp:BoundField DataField="CompanyId" HeaderText="Id Empresa" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="Name" HeaderText="Empresa" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="LegalRegistrationId" HeaderText="CNPJ" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:BoundField DataField="SinacorCompanyId" HeaderText="ID Sinacor" HeaderStyle-BackColor="#666666"
													HeaderStyle-ForeColor="White" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC"
													ItemStyle-BackColor="White" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC" />
												<asp:TemplateField HeaderText="(+)" HeaderStyle-BackColor="#666666" HeaderStyle-ForeColor="White"
													HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#CCCCCC" ItemStyle-BackColor="White"
													ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#CCCCCC">
													<ItemTemplate>
														<asp:Button ID="btUpdateCompanyAvailable" runat="server" CommandArgument='<%# Eval("CompanyId") %>' CommandName="UpdateAvailable" Text="UPD" CausesValidation="false"/>
													</ItemTemplate>
													<HeaderStyle BackColor="#666666" BorderColor="#CCCCCC" BorderWidth="1px" ForeColor="White" />
													<ItemStyle BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" />
												</asp:TemplateField>
											</Columns>
										</asp:GridView>
									</div>
								</div>
							</p>
						</fieldset>
					</td>
				</tr>
			</table>
		</ContentTemplate>
	</asp:UpdatePanel>
</asp:Content>